home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Shareware / Mockups for Desktop 1.5.27 / MockupsForDesktop.air / MockupsAir.swf / scripts / StorageManagerAir.as < prev    next >
Encoding:
Text File  |  2009-03-03  |  42.9 KB  |  1,290 lines

  1. package
  2. {
  3.    import com.balsamiq.events.FileManagerEvent;
  4.    import com.balsamiq.file.FileDescriptor;
  5.    import com.balsamiq.file.FileManager;
  6.    import com.balsamiq.keygen.BalsamiqKeyGenerator;
  7.    import com.balsamiq.keygen.descriptors.SerialKeyFieldsDescriptor;
  8.    import com.plus9.mockups.Mockups;
  9.    import com.plus9.mockups.dialogs.AreYouSure;
  10.    import com.plus9.mockups.events.MockupModelEvent;
  11.    import com.plus9.mockups.model.ICookieManager;
  12.    import com.plus9.mockups.model.IStorageManager;
  13.    import com.plus9.mockups.ui.LoadingPopUp;
  14.    import flash.data.SQLConnection;
  15.    import flash.data.SQLMode;
  16.    import flash.data.SQLStatement;
  17.    import flash.desktop.Clipboard;
  18.    import flash.desktop.ClipboardFormats;
  19.    import flash.display.BitmapData;
  20.    import flash.display.DisplayObject;
  21.    import flash.events.Event;
  22.    import flash.events.FileListEvent;
  23.    import flash.events.TimerEvent;
  24.    import flash.filesystem.File;
  25.    import flash.filesystem.FileMode;
  26.    import flash.filesystem.FileStream;
  27.    import flash.net.FileFilter;
  28.    import flash.utils.ByteArray;
  29.    import flash.utils.Timer;
  30.    import mx.controls.Alert;
  31.    import mx.core.Application;
  32.    import mx.core.IFlexDisplayObject;
  33.    import mx.managers.CursorManager;
  34.    import mx.managers.PopUpManager;
  35.    
  36.    public class StorageManagerAir extends FileManager implements IStorageManager
  37.    {
  38.       protected var _ultimateAction:String;
  39.       
  40.       protected var _pathsToExport:Array;
  41.       
  42.       protected var _reloadDialog:AreYouSure;
  43.       
  44.       protected var _lastOpenPath:String;
  45.       
  46.       protected var _mockups:Mockups;
  47.       
  48.       protected var _exportingDlg:LoadingPopUp;
  49.       
  50.       protected var _dbFile:File;
  51.       
  52.       protected var _activateDialog:Activate;
  53.       
  54.       protected var _exportPNGDialog:ExportPNGConfirmationDialog;
  55.       
  56.       protected var _multipleUnsavedDlg:SaveMultipleDialog;
  57.       
  58.       protected var _openFile:File;
  59.       
  60.       protected var _saveAsFile:File;
  61.       
  62.       protected var _sqlConnection:SQLConnection;
  63.       
  64.       protected var _activated:Boolean = false;
  65.       
  66.       protected var _exportAllTargetDirPath:String;
  67.       
  68.       protected var _pathsToExportIndex:uint;
  69.       
  70.       protected var _exportedPaths:String;
  71.       
  72.       protected var _exportAllFile:File;
  73.       
  74.       protected var _isExportingAll:Boolean = false;
  75.       
  76.       protected var _confirmDlg:ConfirmationDialog;
  77.       
  78.       protected var _logger:FileLogger;
  79.       
  80.       protected var _checkForUpdatesTimer:Timer;
  81.       
  82.       protected var _unsavedChangesDlg:UnsavedChangesDialog;
  83.       
  84.       protected var _exportingAllAlwaysOverwrite:Boolean = false;
  85.       
  86.       public function StorageManagerAir(param1:Mockups, param2:Boolean = true, param3:String = "")
  87.       {
  88.          var sqlStatement:SQLStatement = null;
  89.          var res:Array = null;
  90.          var p_mockups:Mockups = param1;
  91.          var p_restoreSession:Boolean = param2;
  92.          var p_build:String = param3;
  93.          super();
  94.          _mockups = p_mockups;
  95.          Application.application.stage.nativeWindow.addEventListener(Event.CLOSING,onClosing);
  96.          _dbFile = File.applicationStorageDirectory.resolvePath("MockupsOnAir.db");
  97.          _sqlConnection = new SQLConnection();
  98.          try
  99.          {
  100.             _sqlConnection.open(_dbFile,SQLMode.READ);
  101.             sqlStatement = new SQLStatement();
  102.             sqlStatement.sqlConnection = _sqlConnection;
  103.             sqlStatement.text = "SELECT status FROM activation WHERE id = 0";
  104.             sqlStatement.execute();
  105.             res = sqlStatement.getResult().data;
  106.             _activated = res.length == 1 && res[0].status == true;
  107.          }
  108.          catch(e:Error)
  109.          {
  110.             _activated = false;
  111.          }
  112.          _sqlConnection.close();
  113.          _logger = new FileLogger(p_build);
  114.          _checkForUpdatesTimer = new Timer(5000,0);
  115.          _checkForUpdatesTimer.addEventListener(TimerEvent.TIMER,onCheckForUpdates);
  116.          if(p_restoreSession)
  117.          {
  118.             restoreSession();
  119.          }
  120.       }
  121.       
  122.       protected function openActivateDialog() : void
  123.       {
  124.          if(Boolean(_activateDialog) && Boolean(_activateDialog.parent))
  125.          {
  126.             return;
  127.          }
  128.          _activateDialog = Activate(PopUpManager.createPopUp(DisplayObject(Application.application),Activate,true));
  129.          _activateDialog.addEventListener("myActivate",onActivateDialogActivate);
  130.          _activateDialog.init(_mockups.inputManager);
  131.          _activateDialog.storageManager = this;
  132.          PopUpManager.centerPopUp(IFlexDisplayObject(_activateDialog));
  133.       }
  134.       
  135.       protected function onFileSelectMultiple(param1:FileListEvent) : void
  136.       {
  137.          var _loc3_:File = null;
  138.          var _loc4_:Boolean = false;
  139.          var _loc5_:String = null;
  140.          var _loc6_:uint = 0;
  141.          var _loc7_:FileDescriptor = null;
  142.          _openFile.removeEventListener(FileListEvent.SELECT_MULTIPLE,onFileSelectMultiple);
  143.          _openFile.removeEventListener(Event.CANCEL,onFileCancel);
  144.          var _loc2_:uint = 0;
  145.          while(_loc2_ < param1.files.length)
  146.          {
  147.             _loc3_ = File(param1.files[_loc2_]);
  148.             _loc3_.removeEventListener(FileListEvent.SELECT_MULTIPLE,onFileSelectMultiple);
  149.             _loc3_.removeEventListener(Event.CANCEL,onFileCancel);
  150.             _lastOpenPath = cleanPath(_loc3_.nativePath);
  151.             loadFileFromDisk(_loc3_.nativePath);
  152.             _loc4_ = false;
  153.             _loc6_ = 0;
  154.             for each(_loc7_ in _files)
  155.             {
  156.                if(++_loc6_ > 2)
  157.                {
  158.                   _loc4_ = false;
  159.                   break;
  160.                }
  161.                if(_loc7_.path.indexOf("?") != -1 && !_loc7_.isDirty && !_loc4_)
  162.                {
  163.                   _loc4_ = true;
  164.                   _loc5_ = _loc7_.path;
  165.                }
  166.                else if(_loc7_.path == _loc3_.nativePath)
  167.                {
  168.                }
  169.             }
  170.             if(_loc4_)
  171.             {
  172.                closeFile(_loc5_);
  173.             }
  174.             _loc2_++;
  175.          }
  176.          _openFile.removeEventListener(FileListEvent.SELECT_MULTIPLE,onFileSelectMultiple);
  177.          _openFile.removeEventListener(Event.CANCEL,onFileCancel);
  178.          _openFile = null;
  179.       }
  180.       
  181.       override public function loadFileFromDisk(param1:String) : String
  182.       {
  183.          log("loadFileFromDisk:" + param1);
  184.          param1 = cleanPath(param1);
  185.          var _loc2_:String = loadDataIntoMemory(param1);
  186.          if(_loc2_)
  187.          {
  188.             selectFile(param1);
  189.             saveSession();
  190.          }
  191.          else
  192.          {
  193.             createNewFile();
  194.          }
  195.          return _loc2_;
  196.       }
  197.       
  198.       protected function onCheckForUpdates(param1:TimerEvent = null) : void
  199.       {
  200.          var _loc2_:FileDescriptor = FileDescriptor(_files[_currentPath]);
  201.          if(_loc2_ == null || _loc2_.timeStamp == -1)
  202.          {
  203.             _checkForUpdatesTimer.stop();
  204.             return;
  205.          }
  206.          if(_reloadDialog != null && Boolean(_reloadDialog.parent))
  207.          {
  208.             return;
  209.          }
  210.          var _loc3_:File = new File(_currentPath);
  211.          if(_loc3_.modificationDate.getTime() > _loc2_.timeStamp)
  212.          {
  213.             _reloadDialog = AreYouSure(PopUpManager.createPopUp(DisplayObject(Application.application),AreYouSure,true));
  214.             _reloadDialog.title = "File Changed on Disk";
  215.             _reloadDialog.message = "The file you are editing was changed on disc.\nWould you like to reload the file and accept the changes?";
  216.             _reloadDialog.okLabel = "Reload the File";
  217.             _reloadDialog.addEventListener("yes",onReloadYes);
  218.             _reloadDialog.addEventListener("no",onReloadNo);
  219.             _reloadDialog.init(_mockups.inputManager);
  220.             PopUpManager.centerPopUp(IFlexDisplayObject(_reloadDialog));
  221.             _checkForUpdatesTimer.stop();
  222.          }
  223.       }
  224.       
  225.       public function isValidKey(param1:String, param2:String) : Boolean
  226.       {
  227.          var d:SerialKeyFieldsDescriptor = null;
  228.          var p_name:String = param1;
  229.          var p_key:String = param2;
  230.          var e:Boolean = true;
  231.          e &&= p_name.length > 2;
  232.          try
  233.          {
  234.             d = BalsamiqKeyGenerator.decriptKey(p_key);
  235.             e &&= d.productName == "MockupsConfluence" || d.productName == "MockupsJIRA" || d.productName == "MockupsXWiki" || d.productName == "MockupsAir";
  236.             e &&= BalsamiqKeyGenerator.cleanCompanyName(p_name) == BalsamiqKeyGenerator.cleanCompanyName(d.companyName);
  237.          }
  238.          catch(e:Error)
  239.          {
  240.             e = false;
  241.          }
  242.          return e;
  243.       }
  244.       
  245.       protected function promptToSave() : void
  246.       {
  247.          var _loc3_:FileDescriptor = null;
  248.          if(_unsavedChangesDlg && _unsavedChangesDlg.parent || _multipleUnsavedDlg && _multipleUnsavedDlg.parent)
  249.          {
  250.             return;
  251.          }
  252.          var _loc1_:uint = 0;
  253.          var _loc2_:Array = new Array();
  254.          for each(_loc3_ in _files)
  255.          {
  256.             if(_loc3_.isDirty)
  257.             {
  258.                _loc1_++;
  259.                _loc2_.push({
  260.                   "label":_loc3_.name,
  261.                   "selected":true,
  262.                   "path":_loc3_.path
  263.                });
  264.             }
  265.          }
  266.          if(_loc1_ == 1)
  267.          {
  268.             promptToSaveFile(_loc2_[0].label,_loc2_[0].path);
  269.          }
  270.          else if(_loc1_ > 1)
  271.          {
  272.             _multipleUnsavedDlg = SaveMultipleDialog(PopUpManager.createPopUp(DisplayObject(Application.application),SaveMultipleDialog,true));
  273.             _multipleUnsavedDlg.init(_mockups.inputManager);
  274.             _multipleUnsavedDlg.dataProvider = _loc2_;
  275.             _multipleUnsavedDlg.addEventListener("ok",onMultiplePromptSave);
  276.             PopUpManager.centerPopUp(IFlexDisplayObject(_multipleUnsavedDlg));
  277.          }
  278.       }
  279.       
  280.       protected function restoreSession() : void
  281.       {
  282.          var _loc4_:String = null;
  283.          var _loc5_:Object = null;
  284.          var _loc6_:uint = 0;
  285.          var _loc7_:uint = 0;
  286.          var _loc8_:String = null;
  287.          var _loc1_:ICookieManager = _mockups.model.cookieManager;
  288.          var _loc2_:Object = _loc1_.getProperty("fileName",null);
  289.          if(_loc2_ == null)
  290.          {
  291.             createNewFile();
  292.          }
  293.          else
  294.          {
  295.             _loc5_ = _loc1_.getProperty("lastPathSelected",null);
  296.             if(_loc5_ != null && String(_loc5_).indexOf("?") == -1)
  297.             {
  298.                _loc4_ = String(_loc5_);
  299.             }
  300.             _loc6_ = (_loc2_ as Array).length;
  301.             if(_loc6_ == 0)
  302.             {
  303.                createNewFile();
  304.             }
  305.             else
  306.             {
  307.                _loc7_ = 0;
  308.                while(_loc7_ < _loc6_)
  309.                {
  310.                   _loc8_ = _loc2_[_loc7_];
  311.                   if(_loc8_.indexOf("?") == -1)
  312.                   {
  313.                      if(!_loc4_ && _loc7_ == _loc6_ - 1)
  314.                      {
  315.                         loadFileFromDisk(_loc8_);
  316.                      }
  317.                      else
  318.                      {
  319.                         loadDataIntoMemory(_loc8_);
  320.                      }
  321.                   }
  322.                   _loc7_++;
  323.                }
  324.                if(_loc4_)
  325.                {
  326.                   if(FileDescriptor(_files[_loc4_]) != null)
  327.                   {
  328.                      selectFile(_loc4_);
  329.                   }
  330.                   else
  331.                   {
  332.                      createNewFile();
  333.                   }
  334.                }
  335.             }
  336.          }
  337.          var _loc3_:Object = _loc1_.getProperty("lastOpenPath",null);
  338.          _lastOpenPath = _loc3_ == null ? null : cleanPath(String(_loc3_));
  339.       }
  340.       
  341.       public function snapshotAll() : void
  342.       {
  343.          if(!_activated)
  344.          {
  345.             openActivateDialog();
  346.             _activateDialog.toDoNext = "snapshotAll";
  347.             return;
  348.          }
  349.          CursorManager.setBusyCursor();
  350.          if(_exportAllFile)
  351.          {
  352.             _exportAllFile.removeEventListener(Event.SELECT,onExportAllSelect);
  353.             _exportAllFile.removeEventListener(Event.CANCEL,onExportAllCancel);
  354.             _exportAllFile = null;
  355.          }
  356.          _exportAllFile = new File();
  357.          _exportAllFile.addEventListener(Event.SELECT,onExportAllSelect);
  358.          _exportAllFile.addEventListener(Event.CANCEL,onExportAllCancel);
  359.          _exportAllFile.browseForDirectory("Where would you like to store the exported PNGs?");
  360.       }
  361.       
  362.       public function savePath(param1:String) : void
  363.       {
  364.          if(!_activated)
  365.          {
  366.             openActivateDialog();
  367.             _activateDialog.toDoNext = "save";
  368.             return;
  369.          }
  370.          if(param1.indexOf("?") != -1)
  371.          {
  372.             saveAs();
  373.             return;
  374.          }
  375.          updateDataFromMockup();
  376.          saveFileToDisk(param1);
  377.          updateNativeWindowTitle();
  378.       }
  379.       
  380.       override public function log(param1:String) : void
  381.       {
  382.          trace("LOG: " + param1);
  383.          _logger.log(param1);
  384.       }
  385.       
  386.       protected function onExportAllCancel(param1:Event) : void
  387.       {
  388.          _exportAllFile.removeEventListener(Event.SELECT,onExportAllSelect);
  389.          _exportAllFile.removeEventListener(Event.CANCEL,onExportAllCancel);
  390.          _exportAllFile = null;
  391.       }
  392.       
  393.       public function open(param1:Boolean = false) : void
  394.       {
  395.          var p_force:Boolean = param1;
  396.          if(!_activated)
  397.          {
  398.             openActivateDialog();
  399.             _activateDialog.toDoNext = "open";
  400.             return;
  401.          }
  402.          log("OPEN: _lastOpenPath: null? " + (_lastOpenPath == null) + ", empty? " + (_lastOpenPath == ""));
  403.          try
  404.          {
  405.             if(_openFile != null)
  406.             {
  407.                _openFile.removeEventListener(FileListEvent.SELECT_MULTIPLE,onFileSelectMultiple);
  408.                _openFile.removeEventListener(Event.CANCEL,onFileCancel);
  409.                _openFile = null;
  410.             }
  411.             if(_lastOpenPath == null || _lastOpenPath == "")
  412.             {
  413.                _openFile = File.desktopDirectory;
  414.             }
  415.             else
  416.             {
  417.                _openFile = new File(_lastOpenPath);
  418.                if(Boolean(_openFile) && !_openFile.isDirectory)
  419.                {
  420.                   _openFile = _openFile.parent;
  421.                }
  422.                else if(!_openFile)
  423.                {
  424.                   _openFile = File.desktopDirectory;
  425.                }
  426.             }
  427.          }
  428.          catch(e:Error)
  429.          {
  430.             Alert.show("problem selecing _openFile:" + e.toString());
  431.             log("problem selecing _openFile:" + e.toString());
  432.          }
  433.          try
  434.          {
  435.             _openFile.addEventListener(FileListEvent.SELECT_MULTIPLE,onFileSelectMultiple);
  436.             _openFile.addEventListener(Event.CANCEL,onFileCancel);
  437.             _openFile.browseForOpenMultiple("",[new FileFilter("Mockups","*.bmml;*.xml"),new FileFilter("XML","*.xml"),new FileFilter("Balsamiq Mockups Markup Language","*.bmml")]);
  438.          }
  439.          catch(e2:Error)
  440.          {
  441.             Alert.show("problem browsing for open:" + e2.toString());
  442.             log("problem browsing for open:" + e2.toString());
  443.          }
  444.       }
  445.       
  446.       protected function onFileCancel(param1:Event) : void
  447.       {
  448.          _openFile.removeEventListener(FileListEvent.SELECT_MULTIPLE,onFileSelectMultiple);
  449.          _openFile.removeEventListener(Event.CANCEL,onFileCancel);
  450.          _openFile = null;
  451.       }
  452.       
  453.       public function quit(param1:Boolean = false) : void
  454.       {
  455.          updateDataFromMockup();
  456.          if(_currentPath != null && getDirtyMockupsCount() > 0 && !param1)
  457.          {
  458.             _ultimateAction = "quit";
  459.             promptToSave();
  460.          }
  461.          else
  462.          {
  463.             saveSession();
  464.             _logger.close();
  465.             Application.application.nativeApplication.exit();
  466.          }
  467.       }
  468.       
  469.       protected function onPromptSave(param1:Event) : void
  470.       {
  471.          if(_unsavedChangesDlg.path.indexOf("?") != -1)
  472.          {
  473.             saveAs();
  474.             return;
  475.          }
  476.          saveFileToDisk(_unsavedChangesDlg.path);
  477.          performUltimateAction();
  478.       }
  479.       
  480.       protected function saveSession() : void
  481.       {
  482.          var _loc2_:FileDescriptor = null;
  483.          var _loc3_:ICookieManager = null;
  484.          var _loc1_:Array = new Array();
  485.          for each(_loc2_ in _files)
  486.          {
  487.             if(_loc2_.path.indexOf("?") == -1)
  488.             {
  489.                _loc1_.push(_loc2_.path);
  490.             }
  491.          }
  492.          _loc3_ = _mockups.model.cookieManager;
  493.          _loc3_.setProperty("fileName",_loc1_);
  494.          if(_currentPath.indexOf("?") == -1)
  495.          {
  496.             _loc3_.setProperty("lastPathSelected",cleanPath(_currentPath));
  497.          }
  498.          _loc3_.setProperty("lastOpenPath",cleanPath(_lastOpenPath));
  499.       }
  500.       
  501.       protected function onReloadNo(param1:Event = null) : void
  502.       {
  503.          _reloadDialog.removeEventListener("yes",onReloadYes);
  504.          _reloadDialog.removeEventListener("no",onReloadNo);
  505.          _reloadDialog.closeYourself();
  506.          _reloadDialog = null;
  507.       }
  508.       
  509.       protected function updateDataFromMockup() : void
  510.       {
  511.          FileDescriptor(_files[_currentPath]).data = _mockups.getXMLData().toXMLString();
  512.       }
  513.       
  514.       protected function onSaveAsCancel(param1:Event) : void
  515.       {
  516.          _saveAsFile.removeEventListener(Event.SELECT,onSaveAsSelect);
  517.          _saveAsFile.removeEventListener(Event.CANCEL,onSaveAsCancel);
  518.       }
  519.       
  520.       public function loadDataIntoMemory(param1:String) : String
  521.       {
  522.          var dataIsValid:Boolean;
  523.          var fileStream:FileStream;
  524.          var f:File = null;
  525.          var data:String = null;
  526.          var xmlData:XML = null;
  527.          var name:String = null;
  528.          var desc:FileDescriptor = null;
  529.          var p_path:String = param1;
  530.          log("loadDataIntoMemory:" + p_path);
  531.          p_path = cleanPath(p_path);
  532.          if(p_path == null || p_path.indexOf("?") != -1)
  533.          {
  534.             return "";
  535.          }
  536.          try
  537.          {
  538.             f = new File(p_path);
  539.          }
  540.          catch(e:Error)
  541.          {
  542.             Alert.show("The file " + p_path + " cannot be loaded (bad path).");
  543.             log("\tERROR: could not load:" + p_path);
  544.             return "";
  545.          }
  546.          if(!f.exists)
  547.          {
  548.             Alert.show("The file " + p_path + " cannot be loaded (file doesn\'t exist).");
  549.             log("\tERROR: file doesn\'t exist");
  550.             return "";
  551.          }
  552.          CursorManager.setBusyCursor();
  553.          fileStream = new FileStream();
  554.          fileStream.open(f,FileMode.READ);
  555.          data = fileStream.readUTFBytes(f.size);
  556.          fileStream.close();
  557.          CursorManager.removeBusyCursor();
  558.          dataIsValid = false;
  559.          try
  560.          {
  561.             xmlData = XML(data);
  562.             dataIsValid = _mockups.model.validateXMLData(xmlData);
  563.          }
  564.          catch(e:Error)
  565.          {
  566.             Alert.show("The file " + f.name + " cannot be loaded (invalid data). Please see the BalsamiqMockups.log files for details");
  567.             log("Data is invalid:");
  568.             log("====\n" + data + "====");
  569.             dataIsValid = false;
  570.          }
  571.          if(dataIsValid)
  572.          {
  573.             name = p_path.replace(/\\/g,"/");
  574.             desc = new FileDescriptor(p_path,unescape(name.substr(name.lastIndexOf("/") + 1)),false,data,f.modificationDate.getTime());
  575.             _files[desc.path] = desc;
  576.             dispatchEvent(new FileManagerEvent(FileManagerEvent.FILE_LIST_CHANGE));
  577.          }
  578.          else
  579.          {
  580.             data = "";
  581.          }
  582.          return data;
  583.       }
  584.       
  585.       protected function takeSnapshot(param1:String = null) : String
  586.       {
  587.          var _loc2_:File = null;
  588.          var _loc5_:String = null;
  589.          var _loc6_:uint = 0;
  590.          if(param1 == null)
  591.          {
  592.             _loc5_ = "mockup";
  593.             if(_currentPath == null || _currentPath.indexOf("?") != -1)
  594.             {
  595.                _loc5_ = "mockup";
  596.                _loc2_ = File.desktopDirectory.resolvePath(_loc5_ + ".png");
  597.             }
  598.             else
  599.             {
  600.                if(_currentPath.lastIndexOf(".") == -1)
  601.                {
  602.                   _loc5_ = _currentPath;
  603.                }
  604.                else
  605.                {
  606.                   _loc5_ = _currentPath.substr(0,_currentPath.lastIndexOf("."));
  607.                }
  608.                if(_isExportingAll)
  609.                {
  610.                   _loc5_ = _exportAllTargetDirPath + _loc5_.substr(_loc5_.lastIndexOf(File.separator));
  611.                }
  612.                _loc2_ = new File(_loc5_ + ".png");
  613.             }
  614.             if(_loc2_.exists)
  615.             {
  616.                if(!(_isExportingAll && _exportingAllAlwaysOverwrite))
  617.                {
  618.                   _loc6_ = 1;
  619.                   while(_loc2_.exists)
  620.                   {
  621.                      _loc6_++;
  622.                      if(_currentPath == null || _currentPath.indexOf("?") != -1)
  623.                      {
  624.                         _loc2_ = File.desktopDirectory.resolvePath(_loc5_ + "_" + _loc6_ + ".png");
  625.                      }
  626.                      else
  627.                      {
  628.                         _loc2_ = new File(_loc5_ + "_" + _loc6_ + ".png");
  629.                      }
  630.                   }
  631.                   _exportPNGDialog = ExportPNGConfirmationDialog(PopUpManager.createPopUp(DisplayObject(Application.application),ExportPNGConfirmationDialog,true));
  632.                   _exportPNGDialog.kind = _isExportingAll ? ExportPNGConfirmationDialog.KIND_MULTIPLE : ExportPNGConfirmationDialog.KIND_SINGLE;
  633.                   _exportPNGDialog.initExportPNGConfirmationDialog(_mockups.inputManager,_loc5_,_loc2_);
  634.                   _exportPNGDialog.addEventListener("exportClick",onExportPNGDialogClick);
  635.                   PopUpManager.centerPopUp(IFlexDisplayObject(_exportPNGDialog));
  636.                   return null;
  637.                }
  638.             }
  639.          }
  640.          else
  641.          {
  642.             _loc2_ = new File(param1);
  643.          }
  644.          var _loc3_:ByteArray = _mockups.getPNGsnapshot();
  645.          var _loc4_:FileStream = new FileStream();
  646.          _loc4_.open(_loc2_,FileMode.WRITE);
  647.          _loc4_.writeBytes(_loc3_);
  648.          _loc4_.close();
  649.          return _loc2_.nativePath;
  650.       }
  651.       
  652.       public function newMockup() : void
  653.       {
  654.          createNewFile();
  655.       }
  656.       
  657.       public function closeAllFiles() : void
  658.       {
  659.          var _loc1_:FileDescriptor = null;
  660.          var _loc2_:Boolean = false;
  661.          if(_currentPath == null)
  662.          {
  663.             return;
  664.          }
  665.          for each(_loc1_ in _files)
  666.          {
  667.             _loc2_ = _loc1_.isDirty;
  668.             closeFileWithPrompt(_loc1_.path);
  669.             if(_loc2_)
  670.             {
  671.                break;
  672.             }
  673.          }
  674.       }
  675.       
  676.       protected function onReloadYes(param1:Event) : void
  677.       {
  678.          var _loc2_:String = _currentPath;
  679.          closeCurrentFile(true);
  680.          loadFileFromDisk(_loc2_);
  681.          onReloadNo();
  682.       }
  683.       
  684.       protected function onMultiplePromptSave(param1:Event) : void
  685.       {
  686.          var _loc2_:Object = null;
  687.          for each(_loc2_ in _multipleUnsavedDlg.dataProvider)
  688.          {
  689.             if(_loc2_.selected)
  690.             {
  691.                if(_loc2_.path.indexOf("?") != -1)
  692.                {
  693.                   saveAs();
  694.                }
  695.                else
  696.                {
  697.                   saveFileToDisk(_loc2_.path);
  698.                }
  699.             }
  700.          }
  701.          performUltimateAction();
  702.       }
  703.       
  704.       public function deactivate() : void
  705.       {
  706.          var sqlStatement:SQLStatement = null;
  707.          var debugSqlConnection:SQLConnection = new SQLConnection();
  708.          try
  709.          {
  710.             debugSqlConnection.open(_dbFile,SQLMode.UPDATE);
  711.             sqlStatement = new SQLStatement();
  712.             sqlStatement.sqlConnection = debugSqlConnection;
  713.             sqlStatement.text = "DROP TABLE activation;";
  714.             sqlStatement.execute();
  715.             debugSqlConnection.close();
  716.          }
  717.          catch(e:Error)
  718.          {
  719.             trace("wha?" + e.errorID + ", " + e.toString());
  720.          }
  721.          _activated = false;
  722.       }
  723.       
  724.       public function save() : void
  725.       {
  726.          if(_currentPath == null)
  727.          {
  728.             return;
  729.          }
  730.          if(!_activated)
  731.          {
  732.             openActivateDialog();
  733.             _activateDialog.toDoNext = "save";
  734.             return;
  735.          }
  736.          if(_currentPath.indexOf("?") != -1)
  737.          {
  738.             saveAs();
  739.             return;
  740.          }
  741.          log("save, saving currentPath in model:" + _currentPath);
  742.          _mockups.model.currentPath = _currentPath;
  743.          updateDataFromMockup();
  744.          saveFileToDisk(_currentPath);
  745.          saveSession();
  746.          setDirty(false);
  747.          performUltimateAction();
  748.          updateNativeWindowTitle();
  749.       }
  750.       
  751.       public function closeFileWithPrompt(param1:String, param2:Boolean = false) : void
  752.       {
  753.          if(FileDescriptor(_files[param1]).isDirty && !param2)
  754.          {
  755.             _ultimateAction = "close";
  756.             updateDataFromMockup();
  757.             promptToSaveFile(FileDescriptor(_files[param1]).name,param1);
  758.          }
  759.          else
  760.          {
  761.             trace("closeFileWithPrompt " + param1);
  762.             closeFile(param1);
  763.             saveSession();
  764.             if(_currentPath == null)
  765.             {
  766.                _mockups.model.clearCurrentMockup();
  767.             }
  768.          }
  769.       }
  770.       
  771.       override protected function setCurrentPath(param1:String) : void
  772.       {
  773.          log("setCurrentPath:" + param1);
  774.          super.setCurrentPath(param1);
  775.          _mockups.model.currentPath = _currentPath;
  776.          _checkForUpdatesTimer.stop();
  777.          if(_currentPath.indexOf("?") == -1)
  778.          {
  779.             onCheckForUpdates();
  780.             trace("STARTING TIMER!");
  781.             _checkForUpdatesTimer.start();
  782.          }
  783.       }
  784.       
  785.       protected function exportNextPath() : void
  786.       {
  787.          var _loc1_:FileDescriptor = null;
  788.          if(_pathsToExportIndex > 0)
  789.          {
  790.             --_pathsToExportIndex;
  791.             _loc1_ = _pathsToExport[_pathsToExportIndex];
  792.             selectFile(_loc1_.path);
  793.          }
  794.          else
  795.          {
  796.             PopUpManager.removePopUp(_exportingDlg);
  797.             _exportingDlg = null;
  798.             _pathsToExportIndex = 0;
  799.             _pathsToExport = null;
  800.             _mockups.model.removeEventListener(MockupModelEvent.VIEW_IS_READY,onViewIsReady);
  801.             _isExportingAll = false;
  802.             _exportingAllAlwaysOverwrite = false;
  803.             _exportAllTargetDirPath = null;
  804.             CursorManager.removeBusyCursor();
  805.             _confirmDlg = ConfirmationDialog(PopUpManager.createPopUp(DisplayObject(Application.application),ConfirmationDialog,true));
  806.             _confirmDlg.init(_mockups.inputManager);
  807.             _confirmDlg.dialogTitle = "Images Saved";
  808.             _confirmDlg.message = "Your mockups were exported to \n" + _exportedPaths;
  809.             PopUpManager.centerPopUp(IFlexDisplayObject(_confirmDlg));
  810.          }
  811.       }
  812.       
  813.       public function saveAs() : void
  814.       {
  815.          if(_currentPath == null)
  816.          {
  817.             return;
  818.          }
  819.          if(!_activated)
  820.          {
  821.             openActivateDialog();
  822.             _activateDialog.toDoNext = "saveas";
  823.             return;
  824.          }
  825.          log("saveAs: _lastOpenPath:" + _lastOpenPath);
  826.          try
  827.          {
  828.             if(_saveAsFile)
  829.             {
  830.                _saveAsFile.removeEventListener(Event.SELECT,onSaveAsSelect);
  831.                _saveAsFile.removeEventListener(Event.CANCEL,onSaveAsCancel);
  832.             }
  833.             if(_lastOpenPath == null || _lastOpenPath == "")
  834.             {
  835.                _saveAsFile = File.desktopDirectory;
  836.             }
  837.             else
  838.             {
  839.                _saveAsFile = new File(_lastOpenPath);
  840.                if(Boolean(_saveAsFile) && !_saveAsFile.isDirectory)
  841.                {
  842.                   _saveAsFile = _saveAsFile.parent;
  843.                }
  844.                else if(!_saveAsFile)
  845.                {
  846.                   _saveAsFile = File.desktopDirectory;
  847.                }
  848.             }
  849.          }
  850.          catch(e:Error)
  851.          {
  852.             Alert.show("unable to select _saveAsFile: " + e.toString());
  853.             log("unable to select _saveAsFile: " + e.toString());
  854.          }
  855.          try
  856.          {
  857.             log("_saveAsFile.nativePath:" + _saveAsFile.nativePath);
  858.             _saveAsFile.addEventListener(Event.SELECT,onSaveAsSelect);
  859.             _saveAsFile.addEventListener(Event.CANCEL,onSaveAsCancel);
  860.             _saveAsFile.browseForSave("");
  861.          }
  862.          catch(e2:Error)
  863.          {
  864.             Alert.show("unable to start save-as operation: " + e2.toString());
  865.             log("unable to start save-as operation: " + e2.toString());
  866.          }
  867.       }
  868.       
  869.       public function setDirty(param1:Boolean = true, param2:Boolean = false) : void
  870.       {
  871.          if(param2)
  872.          {
  873.             return;
  874.          }
  875.          if(_currentPath != null && FileDescriptor(_files[_currentPath]).isDirty != param1)
  876.          {
  877.             FileDescriptor(_files[_currentPath]).isDirty = param1;
  878.             updateNativeWindowTitle();
  879.             dispatchEvent(new FileManagerEvent(FileManagerEvent.FILE_LIST_CHANGE));
  880.          }
  881.       }
  882.       
  883.       public function getImageURL(param1:String) : String
  884.       {
  885.          return param1;
  886.       }
  887.       
  888.       override public function saveAllFilesToDisk() : void
  889.       {
  890.          updateDataFromMockup();
  891.          super.saveAllFilesToDisk();
  892.       }
  893.       
  894.       protected function getDirtyMockupsCount() : uint
  895.       {
  896.          var _loc2_:FileDescriptor = null;
  897.          var _loc1_:uint = 0;
  898.          for each(_loc2_ in _files)
  899.          {
  900.             if(_loc2_.isDirty)
  901.             {
  902.                _loc1_++;
  903.             }
  904.          }
  905.          return _loc1_;
  906.       }
  907.       
  908.       override public function selectFile(param1:String) : void
  909.       {
  910.          var _loc2_:Array = null;
  911.          var _loc5_:Boolean = false;
  912.          if(_files[param1] == null)
  913.          {
  914.             return;
  915.          }
  916.          if(_currentPath)
  917.          {
  918.             updateDataFromMockup();
  919.             _loc5_ = FileDescriptor(_files[_currentPath]).isDirty;
  920.             _mockups.model.allowNonDraggingKeyCommands = true;
  921.             _mockups.model.clearCurrentMockup();
  922.             _loc2_ = _mockups.model.getClipboard();
  923.             setDirty(_loc5_);
  924.          }
  925.          super.selectFile(param1);
  926.          var _loc3_:XML = new XML(FileDescriptor(_files[_currentPath]).data);
  927.          var _loc4_:Boolean = _mockups.model.validateXMLData(_loc3_);
  928.          if(_loc4_)
  929.          {
  930.             _mockups.model.loadXMLData(_loc3_,_currentPath);
  931.          }
  932.          else
  933.          {
  934.             createNewFile();
  935.          }
  936.          if(_loc2_)
  937.          {
  938.             _mockups.model.setClipboard(_loc2_);
  939.          }
  940.          updateNativeWindowTitle();
  941.       }
  942.       
  943.       public function registerWithKey(param1:String, param2:String) : Boolean
  944.       {
  945.          var _loc3_:Boolean = isValidKey(param1,param2);
  946.          if(_loc3_)
  947.          {
  948.             activate();
  949.          }
  950.          return _loc3_;
  951.       }
  952.       
  953.       public function closeCurrentFile(param1:Boolean = false) : void
  954.       {
  955.          if(_currentPath == null)
  956.          {
  957.             return;
  958.          }
  959.          closeFileWithPrompt(_currentPath,param1);
  960.       }
  961.       
  962.       protected function onExportPNGDialogClick(param1:Event) : void
  963.       {
  964.          var _loc3_:String = null;
  965.          _exportPNGDialog.removeEventListener("exportClick",onExportPNGDialogClick);
  966.          trace(_exportPNGDialog.selection,_exportPNGDialog.fullPathToUse);
  967.          var _loc2_:Boolean = false;
  968.          switch(_exportPNGDialog.selection)
  969.          {
  970.             case ExportPNGConfirmationDialog.SELECTION_APPEND:
  971.             case ExportPNGConfirmationDialog.SELECTION_REPLACE:
  972.                if(_isExportingAll)
  973.                {
  974.                   _loc2_ = true;
  975.                }
  976.                else
  977.                {
  978.                   snapshot(_exportPNGDialog.fullPathToUse);
  979.                }
  980.                break;
  981.             case ExportPNGConfirmationDialog.SELECTION_REPLACE_ALL:
  982.                if(_isExportingAll)
  983.                {
  984.                   _exportingAllAlwaysOverwrite = true;
  985.                   _loc2_ = true;
  986.                }
  987.          }
  988.          _exportPNGDialog.closeYourself();
  989.          if(_loc2_)
  990.          {
  991.             _loc3_ = takeSnapshot(_exportPNGDialog.fullPathToUse);
  992.             _exportedPaths += _loc3_ + "\n";
  993.             exportNextPath();
  994.          }
  995.       }
  996.       
  997.       public function register() : void
  998.       {
  999.          if(!_activated)
  1000.          {
  1001.             openActivateDialog();
  1002.          }
  1003.          else
  1004.          {
  1005.             if(Boolean(_confirmDlg) && Boolean(_confirmDlg.parent))
  1006.             {
  1007.                return;
  1008.             }
  1009.             _confirmDlg = ConfirmationDialog(PopUpManager.createPopUp(DisplayObject(Application.application),ConfirmationDialog,true));
  1010.             _confirmDlg.dialogTitle = "Software Already Registered";
  1011.             _confirmDlg.message = "Your copy of Balsamiq Mockups for Desktop has already been registered.";
  1012.             _confirmDlg.init(_mockups.inputManager);
  1013.             PopUpManager.centerPopUp(IFlexDisplayObject(_confirmDlg));
  1014.          }
  1015.       }
  1016.       
  1017.       public function print() : void
  1018.       {
  1019.          _mockups.print();
  1020.       }
  1021.       
  1022.       protected function getPrettyPath() : String
  1023.       {
  1024.          var _loc1_:FileDescriptor = null;
  1025.          var _loc2_:String = null;
  1026.          if(_currentPath)
  1027.          {
  1028.             _loc1_ = getFileDescriptor(_currentPath);
  1029.             _loc2_ = getFileDescriptor(_currentPath).path;
  1030.             if(_loc1_.name == "")
  1031.             {
  1032.                _loc2_ = "New Mockup";
  1033.             }
  1034.             return _loc2_;
  1035.          }
  1036.          return "";
  1037.       }
  1038.       
  1039.       protected function performUltimateAction() : void
  1040.       {
  1041.          if(_ultimateAction == null)
  1042.          {
  1043.             return;
  1044.          }
  1045.          switch(_ultimateAction)
  1046.          {
  1047.             case "open":
  1048.                open(true);
  1049.                break;
  1050.             case "close":
  1051.                closeCurrentFile(true);
  1052.                break;
  1053.             case "quit":
  1054.                quit(true);
  1055.          }
  1056.          _ultimateAction = null;
  1057.       }
  1058.       
  1059.       protected function promptToSaveFile(param1:String, param2:String) : void
  1060.       {
  1061.          if(Boolean(_unsavedChangesDlg) && Boolean(_unsavedChangesDlg.parent))
  1062.          {
  1063.             return;
  1064.          }
  1065.          _unsavedChangesDlg = UnsavedChangesDialog(PopUpManager.createPopUp(DisplayObject(Application.application),UnsavedChangesDialog,true));
  1066.          _unsavedChangesDlg.init(_mockups.inputManager);
  1067.          _unsavedChangesDlg.setFileNamePath(param1,param2);
  1068.          _unsavedChangesDlg.addEventListener("save",onPromptSave);
  1069.          _unsavedChangesDlg.addEventListener("dontsave",onPromptDontSave);
  1070.          PopUpManager.centerPopUp(IFlexDisplayObject(_unsavedChangesDlg));
  1071.       }
  1072.       
  1073.       override public function saveFileToDisk(param1:String) : void
  1074.       {
  1075.          if(param1.indexOf("?") != -1)
  1076.          {
  1077.             return;
  1078.          }
  1079.          log("saveFileToDisk:" + param1);
  1080.          super.saveFileToDisk(param1);
  1081.          updateNativeWindowTitle();
  1082.          var _loc2_:FileDescriptor = FileDescriptor(_files[param1]);
  1083.          _mockups.model.localMockupsCache.cacheMockup(_loc2_.name,_loc2_.data);
  1084.       }
  1085.       
  1086.       public function snapshot(param1:String = null) : void
  1087.       {
  1088.          if(!_activated)
  1089.          {
  1090.             openActivateDialog();
  1091.             _activateDialog.toDoNext = "snapshot";
  1092.             return;
  1093.          }
  1094.          CursorManager.setBusyCursor();
  1095.          var _loc2_:String = takeSnapshot(param1);
  1096.          if(_loc2_ == null)
  1097.          {
  1098.             return;
  1099.          }
  1100.          CursorManager.removeBusyCursor();
  1101.          if(Boolean(_confirmDlg) && Boolean(_confirmDlg.parent))
  1102.          {
  1103.             PopUpManager.removePopUp(_confirmDlg);
  1104.             _confirmDlg = null;
  1105.          }
  1106.          _confirmDlg = ConfirmationDialog(PopUpManager.createPopUp(DisplayObject(Application.application),ConfirmationDialog,true));
  1107.          _confirmDlg.init(_mockups.inputManager);
  1108.          _confirmDlg.dialogTitle = "Image Saved";
  1109.          _confirmDlg.message = "Your mockup was exported to " + _loc2_;
  1110.          PopUpManager.centerPopUp(IFlexDisplayObject(_confirmDlg));
  1111.       }
  1112.       
  1113.       protected function onExportAllSelect(param1:Event) : void
  1114.       {
  1115.          var _loc2_:FileDescriptor = null;
  1116.          _exportAllFile.removeEventListener(Event.SELECT,onExportAllSelect);
  1117.          _exportAllFile.removeEventListener(Event.CANCEL,onExportAllCancel);
  1118.          _exportAllTargetDirPath = File(param1.target).nativePath;
  1119.          trace(_exportAllTargetDirPath);
  1120.          _mockups.model.addEventListener(MockupModelEvent.VIEW_IS_READY,onViewIsReady);
  1121.          _isExportingAll = true;
  1122.          _pathsToExport = [getFileDescriptor(_currentPath)];
  1123.          for each(_loc2_ in _files)
  1124.          {
  1125.             if(_loc2_.path != _currentPath)
  1126.             {
  1127.                _pathsToExport.push(_loc2_);
  1128.             }
  1129.          }
  1130.          _exportedPaths = "";
  1131.          _pathsToExportIndex = _pathsToExport.length;
  1132.          _exportingDlg = LoadingPopUp(PopUpManager.createPopUp(DisplayObject(Application.application),LoadingPopUp,true));
  1133.          _exportingDlg.title = "Exporting " + _pathsToExport.length + " Mockups...";
  1134.          _exportingDlg.progressBar.indeterminate = true;
  1135.          PopUpManager.centerPopUp(_exportingDlg);
  1136.          PopUpManager.bringToFront(_exportingDlg);
  1137.          exportNextPath();
  1138.          _exportAllFile = null;
  1139.       }
  1140.       
  1141.       public function get activated() : Boolean
  1142.       {
  1143.          return _activated;
  1144.       }
  1145.       
  1146.       public function onViewIsReady(param1:MockupModelEvent) : void
  1147.       {
  1148.          if(!_isExportingAll)
  1149.          {
  1150.             return;
  1151.          }
  1152.          var _loc2_:String = takeSnapshot();
  1153.          if(_loc2_ == null)
  1154.          {
  1155.             return;
  1156.          }
  1157.          _exportedPaths += _loc2_ + "\n";
  1158.          exportNextPath();
  1159.       }
  1160.       
  1161.       public function onClosing(param1:Event) : void
  1162.       {
  1163.          quit();
  1164.          param1.preventDefault();
  1165.       }
  1166.       
  1167.       override public function createCloneOfCurrentMockup() : void
  1168.       {
  1169.          var _loc1_:String = null;
  1170.          if(_currentPath != null)
  1171.          {
  1172.             updateDataFromMockup();
  1173.             _loc1_ = _mockups.getXMLData(true).toXMLString();
  1174.             createNewFile(_loc1_);
  1175.          }
  1176.       }
  1177.       
  1178.       protected function updateNativeWindowTitle() : void
  1179.       {
  1180.          var _loc1_:String = "Balsamiq Mockups For Desktop";
  1181.          if(_currentPath != null)
  1182.          {
  1183.             _loc1_ += " - " + (FileDescriptor(_files[_currentPath]).isDirty ? "* " : "") + getPrettyPath();
  1184.          }
  1185.          Application.application.stage.nativeWindow.title = _loc1_;
  1186.       }
  1187.       
  1188.       protected function onActivateDialogActivate(param1:Event) : void
  1189.       {
  1190.          activate();
  1191.       }
  1192.       
  1193.       protected function onPromptDontSave(param1:Event) : void
  1194.       {
  1195.          performUltimateAction();
  1196.       }
  1197.       
  1198.       protected function activate() : void
  1199.       {
  1200.          _activated = true;
  1201.          dispatchEvent(new Event("activateChange"));
  1202.          _sqlConnection.open(_dbFile,SQLMode.CREATE);
  1203.          var _loc1_:SQLStatement = new SQLStatement();
  1204.          _loc1_.sqlConnection = _sqlConnection;
  1205.          _loc1_.text = "CREATE TABLE activation (id INTEGER PRIMARY KEY, status BOOLEAN);";
  1206.          _loc1_.execute();
  1207.          _loc1_ = new SQLStatement();
  1208.          _loc1_.sqlConnection = _sqlConnection;
  1209.          _loc1_.text = "INSERT INTO activation (id, status) VALUES (0, true);";
  1210.          _loc1_.execute();
  1211.          _sqlConnection.close();
  1212.          var _loc2_:String = _activateDialog.toDoNext;
  1213.          PopUpManager.removePopUp(_activateDialog);
  1214.          switch(_loc2_)
  1215.          {
  1216.             case "save":
  1217.                save();
  1218.                break;
  1219.             case "open":
  1220.                open();
  1221.                break;
  1222.             case "saveas":
  1223.                saveAs();
  1224.                break;
  1225.             case "snapshot":
  1226.                snapshot();
  1227.                break;
  1228.             case "snapshotAll":
  1229.                snapshotAll();
  1230.          }
  1231.       }
  1232.       
  1233.       public function snapshotToClipboard() : void
  1234.       {
  1235.          if(!_activated)
  1236.          {
  1237.             openActivateDialog();
  1238.             _activateDialog.toDoNext = "snapshot";
  1239.             return;
  1240.          }
  1241.          var _loc1_:BitmapData = _mockups.getPNGBitmapData();
  1242.          Clipboard.generalClipboard.setData(ClipboardFormats.BITMAP_FORMAT,_loc1_);
  1243.       }
  1244.       
  1245.       protected function onSaveAsSelect(param1:Event) : void
  1246.       {
  1247.          var _loc2_:String = _saveAsFile.nativePath;
  1248.          log("onSaveAsSelect:" + _loc2_ + " null? " + (_loc2_ == null) + ", empty? " + (_loc2_ == ""));
  1249.          if(File(param1.target) != null)
  1250.          {
  1251.             log("\tp_evt.target: #" + File(param1.target).nativePath + "#");
  1252.          }
  1253.          if(_loc2_ == null || _loc2_ == "")
  1254.          {
  1255.             Alert.show("Error saving file:" + _saveAsFile.url);
  1256.             return;
  1257.          }
  1258.          _saveAsFile.removeEventListener(Event.SELECT,onSaveAsSelect);
  1259.          _saveAsFile.removeEventListener(Event.CANCEL,onSaveAsCancel);
  1260.          var _loc3_:String = _currentPath;
  1261.          setCurrentPath(cleanPath(_loc2_));
  1262.          _lastOpenPath = cleanPath(_loc2_);
  1263.          if(_currentPath.substr(_currentPath.length - 4).toLowerCase() != ".xml" && _currentPath.substr(_currentPath.length - 5).toLowerCase() != ".bmml")
  1264.          {
  1265.             setCurrentPath(_currentPath + ".bmml");
  1266.          }
  1267.          var _loc4_:FileDescriptor = FileDescriptor(_files[_loc3_]).clone();
  1268.          _loc4_.path = _currentPath;
  1269.          var _loc5_:String = _currentPath.replace(/\\/g,"/");
  1270.          _loc4_.name = unescape(_loc5_.substr(_loc5_.lastIndexOf("/") + 1));
  1271.          _files[_currentPath] = _loc4_;
  1272.          if(_loc3_ != _currentPath)
  1273.          {
  1274.             _files[_loc3_] = null;
  1275.             delete _files[_loc3_];
  1276.          }
  1277.          save();
  1278.       }
  1279.       
  1280.       public function close() : void
  1281.       {
  1282.          if(_logger)
  1283.          {
  1284.             _logger.close();
  1285.          }
  1286.       }
  1287.    }
  1288. }
  1289.  
  1290.